/**
 * 
 */
package com.thon.dao.system.impl;


import org.springframework.stereotype.Repository;

import com.thon.dao.system.ConfigureDao;
import com.thon.dao.util.AbstractDao;
import com.thon.entity.system.Configure;



@Repository
public class ConfigureDaoImpl extends AbstractDao<Configure> implements ConfigureDao{
	
	public ConfigureDaoImpl(){
		super(Configure.class);
	}

	@Override
	public Configure getConfigure(Integer unique) {
		String query = "FROM Configure c where c.uniqueId = 1";		
		Configure oldConfigure  =  findOne(query,null);
		if(oldConfigure==null)
		{
			oldConfigure = new Configure();
			oldConfigure.setUniqueId(1);
			save(oldConfigure);
		
		}
		return oldConfigure;
	}

	@Override
	public String getConfigure(String by) {		
		getConfigure(1);
		String query = "SELECT c."+by+" FROM Configure c";		
		return (String) findOneByHql(query);
		
	}
}
